$(document).ready(function () {
    $(".js-example-basic-single").select2();

    var data = [{id: 0, text: 'apple'}, {id: 1, text: 'banana'}, {id: 2, text: 'pear'}];//下拉列表中的数据项

    $("#select2_sample").select2({
        data: data
    });//启动select2

});